home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 3.6 KB | 139 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWCyStrm.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWCYSTRM_H
- #define FWCYSTRM_H
-
- #ifndef FWSOMPTR_H
- #include "FWSOMPtr.h"
- #endif
-
- //-----------------------------------------------------------------------------
- // Includes and Class Declarations
- //-----------------------------------------------------------------------------
-
- #ifndef SOM_FW_OCyberSink_xh
- #include <SLCySink.xh>
- #endif
-
- class FW_OSink;
- class CyberStream;
- class CyberItem;
- class CyberSession;
-
- //-----------------------------------------------------------------------------
- // Cyberdog Utilities
- //-----------------------------------------------------------------------------
-
- // Constant: if (status & FW_kCyberStreamDone) ...
- extern const short FW_kCyberStreamDone; // = kCDErrorOccurred | kCDDownloadComplete | kCDAbortComplete
-
- //========================================================================================
- // Class FW_CCyberStream
- //========================================================================================
-
- /*
- FW_CCyberStream is an envelope class for CyberStream.
- It ensures that CyberStream will be deleted when you're done
- with it. It also makes sure that Abort is properly called if
- the stream has not been fully read.
- */
-
- class FW_CCyberStream {
- public:
- FW_DECLARE_AUTO (FW_CCyberStream)
- FW_CCyberStream (CyberStream* cs = kODNULL);
- ~FW_CCyberStream ();
- FW_CCyberStream& operator= (CyberStream* cs);
- void Assign (CyberStream* cs);
- CyberStream* operator -> ();
- operator CyberStream* ();
- private:
- CyberStream* fStream;
- // Copy construction and assignment are not supported.
- private:
- FW_CCyberStream (const FW_CCyberStream& );
- FW_CCyberStream& operator= (const FW_CCyberStream& );
- };
-
- //========================================================================================
- // Class FW_PCyberSink
- //========================================================================================
-
- /*
- FW_PCyberSink is an envelope class for FW_OCyberSink (which
- itself uses a CyberStream)
- */
-
- class FW_PCyberSink: public FW_TSOMPtr<FW_OCyberSink> {
- public:
- FW_PCyberSink (Environment* ev, CyberStream* cs);
- ~FW_PCyberSink ();
- };
-
- //========================================================================================
- // Class FW_CCyberBuffer
- //========================================================================================
-
- /*
- FW_CCyberBuffer is an envelope class for a buffer aquired from a
- CyberStream. This ensures it is released back to the stream.
- */
-
- class FW_CCyberBuffer {
- public:
- FW_DECLARE_AUTO (FW_CCyberBuffer)
- FW_CCyberBuffer (Environment* ev, CyberStream* cs);
- ~FW_CCyberBuffer ();
- Size GetSize() { return fSize; }
- Ptr GetBuffer() { return fBuffer; }
- private:
- CyberStream* fStream;
- Ptr fBuffer;
- Size fSize;
- };
-
- //-----------------------------------------------------------------------------
- // FW_CCyberStream Inlines
- //-----------------------------------------------------------------------------
-
- inline
- FW_CCyberStream::FW_CCyberStream (CyberStream* cs)
- : fStream(cs)
- {
- }
-
- inline
- FW_CCyberStream::~FW_CCyberStream ()
- {
- Assign(kODNULL);
- }
-
- inline
- FW_CCyberStream& FW_CCyberStream::operator= (CyberStream* cs)
- {
- Assign(cs);
- return *this;
- }
-
- inline CyberStream*
- FW_CCyberStream::operator -> ()
- {
- return fStream;
- }
-
- inline
- FW_CCyberStream::operator CyberStream* ()
- {
- return fStream;
- }
-
- #endif // _FW_CyberdogStreamUtilities_
-
-